home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Add-Ons / MPW / MPW cawf 4.0.9 / ansi.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-01  |  1.8 KB  |  60 lines  |  [TEXT/KAHL]

  1. /* The <ansi.h> header attempts to decide whether the compiler has enough
  2.  * conformance to Standard C for Minix to take advantage of.  If so, the
  3.  * symbol _ANSI is defined (as 31415).  Otherwise _ANSI is not defined
  4.  * here, but it may be defined by applications that want to bend the rules.
  5.  * The magic number in the definition is to inhibit unnecessary bending
  6.  * of the rules.  (For consistency with the new '#ifdef _ANSI" tests in
  7.  * the headers, _ANSI should really be defined as nothing, but that would
  8.  * break many library routines that use "#if _ANSI".)
  9.  
  10.  * If _ANSI ends up being defined, a macro
  11.  *
  12.  *    _PROTOTYPE(function, params)
  13.  *
  14.  * is defined.  This macro expands in different ways, generating either
  15.  * ANSI Standard C prototypes or old-style K&R (Kernighan & Ritchie)
  16.  * prototypes, as needed.  Finally, some programs use _CONST, _VOIDSTAR etc
  17.  * in such a way that they are portable over both ANSI and K&R compilers.
  18.  * The appropriate macros are defined here.
  19.  */
  20.  
  21. #if    !defined(_ANSI_H)
  22. #define _ANSI_H
  23.  
  24. # if    __STDC__ == 1
  25. #define _ANSI        31459    /* compiler claims full ANSI conformance */
  26. # endif    /* __STDC++ == 1 */
  27.  
  28. # if    defined(__GNUC__)
  29. #define _ANSI        31459    /* gcc conforms enough even in non-ANSI mode */
  30. # endif    /* defined(__GNUC__) */
  31.  
  32. # if    defined(_ANSI)
  33.  
  34. /* Keep everything for ANSI prototypes. */
  35. #define    _PROTOTYPE(function, params)    function params
  36.  
  37. #define    _VOIDSTAR    void *
  38. #define    _VOID        void
  39. #define    _CONST        const
  40. #define    _VOLATILE    volatile
  41.  
  42. #if    !defined(_SIZET)
  43. #define _SIZET        size_t
  44. #endif    /* !defined(_SIZET) */
  45.  
  46. # else    /* !defined(_ANSI) */
  47.  
  48. /* Throw away the parameters for K&R prototypes. */
  49. #define    _PROTOTYPE(function, params)    function()
  50.  
  51. #define    _VOIDSTAR    void *
  52. #define    _VOID        void
  53. #define    _CONST
  54. #define    _VOLATILE
  55. #define _SIZET        int
  56.  
  57. # endif    /* defined(_ANSI) */
  58.  
  59. #endif    /* !defined(ANSI_H) */
  60.